#include <Arduino.h>
#include <U8g2lib.h>
//#include <Wire.h>
                    //OLED屏的SDA和SCL分别连接开发板4和5
//iic驱动方式
U8G2_SSD1306_128X64_NONAME_1_SW_I2C u8g2(U8G2_R0, /* clock=*/ SCL, /* data=*/ SDA, /* reset=*/ U8X8_PIN_NONE);

void setup() {
  Serial.begin(115200);
  u8g2.begin();
  u8g2.enableUTF8Print();
}

void loop() {
  u8g2.firstPage();
  do {
    /*
    u8g2.setFont(u8g2_font_unifont_t_chinese2);
    u8g2.setCursor(0, 15);
    u8g2.print("你好");
    u8g2.setFont(u8g2_font_unifont_t_symbols);
    u8g2.drawUTF8(40, 15, ",");
    u8g2.setFont(u8g2_font_unifont_t_chinese2);
    u8g2.setCursor(80, 15);
    u8g2.print("世界");
    */
    
    u8g2.setFont(u8g2_font_unifont_t_chinese3);
    u8g2.drawUTF8(0, 50, "年号");
    u8g2.setFont(u8g2_font_ncenB08_tr); // choose a suitable font
    u8g2.drawStr(0,10,"hello world");  // write something to the internal memory
    u8g2.setFont(u8g2_font_t0_13_tf); // choose a suitable font
    u8g2.drawStr(0,30,"hello world");  // write something to the internal memory
    //u8g2.sendBuffer();          // transfer internal memory to the display
    
    /*
    u8g2.setFont(u8g2_font_unifont_t_chinese1);
    u8g2.drawUTF8(0,15,"你好,MDL机器人.");
    u8g2.setCursor(20, 30);
    u8g2.print("你好,,");
    */
  } while ( u8g2.nextPage() );
  delay(1000);
}
